#ifndef DAQ_H
#define DAQ_H

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "drv_packer.h"

#define AN706_SAMPLENUM (300 * 1024 * 1024 / 2)  // MAX SAMPLE LEN  = 150m POINT
#define AN706_REGBASE (0x43c00000)
#define POWERDOWN 0
#define RANGE_5V 0
#define RANGE_10V 1
#define NO_STAND_BY (1 << 1)
#define NO_OS (0 << 2)
#define OS2 (1 << 2)
#define OS4 (2 << 2)
#define OS8 (3 << 2)
#define OS16 (4 << 2)
#define OS32 (5 << 2)
#define OS64 (6 << 2)
#define CHAN1 (0 << 5)
#define CHAN2 (1 << 5)
#define CHAN3 (2 << 5)
#define CHAN4 (3 << 5)
#define CHAN5 (4 << 5)
#define CHAN6 (5 << 5)
#define CHAN7 (6 << 5)
#define CHAN8 (7 << 5)

#define WRITE_CFG (1 << 4)
#define READ_CFG (1 << 5)


typedef struct
{
    //起始时间
    uint32_t start;
    //采样时间单位秒
    uint32_t len;
    //freq div
    uint32_t div;
    uint32_t ch;
} CAP_PARAM;

typedef enum
{
    STA_READY = 0,
    STA_WAIT_GPS,
    STA_WAIT_CONFIG,
    STA_RUNING,
    STA_STOP,
    STA_INIT
} CAP_ACTION;

typedef enum
{
    LED_WAIT = 0,
    LED_LOCK_TIME,
    LED_READY,
} LED_STATE;

void daq_init();
void daq_process();


void set_led(int id, int stat);
void adc_set_num(int num);
void adc_init() ;
void adc_start(int num);
void adc_set_num(int num) ;
void adc_write_reg(int val) ;

uint8_t g_waitFlag ;
void *g_pAn706DataBufBase;
int net_status;
void send_data(uint8_t *data, uint16_t len);
CMD_Packer net_packer;
#endif













